//
//  Person.m
//  OC - 代码练习
//
//  Created by dllo on 15/12/9.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "Person.h"

@implementation Person
@synthesize name = _name;

- (void)dealloc{
    
    [_name release];
    [_sex release];
    [super dealloc];  
    
    
}

+(instancetype)person{
    
    Person *person = [[Person alloc]init];
    return [person autorelease];
}


- (instancetype)initWithName:(NSString *)name{
    
    self = [super init];
    if (self) {
        _name = [name copy];
    }
    return self;
}




- (void)setName:(NSString *)name{
    
    if (_name != name) {
        [_name release];
        _name = [name retain];
    }
}

- (void)setAge:(NSInteger)age{
    
    _age = age;
    
}



- (NSString *)name{
    
    return [[_name retain]autorelease];
}

















@end
